package cn.com.huzo.repository.master.impl;

import cn.com.huzo.model.entities.master.UserGroupMemberEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.master.UserGroupMemberRepository;

/**
 * 用户组成员数据访问对象。
 *
 * @author 吴旭
 */
@Repository("UserGroupMemberRepository")
public class UserGroupMemberRepositoryImpl extends GenericRepositoryImpl<UserGroupMemberEntity, HashMap>
    implements UserGroupMemberRepository {

    private final String namespace = "cn.com.huzo.repository.master.UserGroupMemberRepository";

    /**
     * 构造函数,设置the entity to UserInUserGroupEntityRepositoryImpl.class.
     */
    public UserGroupMemberRepositoryImpl() {
        super(UserGroupMemberEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer fetchForCount(Map<String, Object> criterion) {
        return getSqlSession().selectOne(MyBatisDaoUtils.getMapperQueryId(
            namespace, "fetchForCount"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer insert(List<UserGroupMemberEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
            namespace, "batchInsert"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<UserGroupMemberEntity> fetchForPage(Map<String, Object> criterion) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
            namespace, "fetchForPage"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(Map<String,Object> criterion) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
            namespace, "delete"), criterion);
    }
}
